import type { EggScheduleConfig } from './config/config.default.ts';
import type { Scheduler } from './lib/schedule.ts';
import type { ScheduleWorker } from './lib/schedule_worker.ts';
import type { BaseStrategy } from './lib/strategy/base.ts';
import type { TimerStrategy } from './lib/strategy/timer.ts';

declare module 'egg' {
  interface EggAppConfig {
    /**
     * Schedule Config
     * @see https://eggjs.org/basics/schedule
     */
    schedule: EggScheduleConfig;
  }

  interface Agent {
    /**
     * Schedule Strategy
     */
    ScheduleStrategy: typeof BaseStrategy;

    /**
     * Timer Schedule Strategy
     */
    TimerScheduleStrategy: typeof TimerStrategy;

    /**
     * Schedule
     */
    schedule: Scheduler;
  }

  interface Application {
    /**
     * Schedule Worker
     */
    scheduleWorker: ScheduleWorker;
    /**
     * Run a schedule, only for unit test
     */
    runSchedule(schedulePath: string, ...args: any[]): Promise<any>;
  }
}
